<?php
namespace Admin\Model;
use Think\Model\RelationModel;
class SpecModel extends RelationModel {
    protected $_link = array(
        'goods_type'  =>  array(
            'mapping_type'          => self::BELONGS_TO ,  //必填项 确定表之间的关系
            'class_name'            => 'goods_type',             //必填项 要关联的表名(副表)
            'foreign_key'           => 'goods_type_id',               //必填项 指中间表中主表的外键字段

        ),

        'spec_item'  =>  array(
            'mapping_type'          => self::HAS_MANY ,  //必填项 确定表之间的关系
            'class_name'            => 'spec_item',             //必填项 要关联的表名(副表)
            'foreign_key'           => 'spec_id',               //必填项 指中间表中主表的外键字段

        ),
    );
}